import {JSJaCPacket} from './JSJaCPacket'
/**
 * A jabber/XMPP message packet
 * @class Models the XMPP notion of an 'message' packet
 * @extends JSJaCPacket
 */
export class JSJaCMessage extends JSJaCPacket{
    constructor() {
        super('message')
        
    }
    /**
     * Sets the body of the message
     * @param {string} body Your message to be sent along
     * @return {JSJaCMessage} this message
     */
    setBodyfunction(body:string):JSJaCMessage {
      this._setChildNode("body",body);
      return this;
    };
    /**
     * Sets the subject of the message
     * @param {string} subject Your subject to be sent along
     * @return {JSJaCMessage} this message
     */
    setSubject(subject:string):JSJaCMessage {
      this._setChildNode("subject",subject);
      return this;
    };
    /**
     * Sets the 'tread' attribute for this message. This is used to identify
     * threads in chat conversations
     * @param {string} thread Usually a somewhat random hash.
     * @returns {JSJaCMessage} this message
     */
    setThread(thread:string):JSJaCMessage {
      this._setChildNode("thread", thread);
      return this;
    };
    /**
     * Gets the 'thread' identifier for this message
     * @return {string} A thread identifier
     */
    getThread():string {
      return this.getChildVal('thread');
    };
    /**
     * Gets the body of this message
     * @return {string} The body of this message
     */
    getBody():string {
      return this.getChildVal('body');
    };
    /**
     * Gets the subject of this message
     * @return {string} The subject of this message
     */
    getSubject():string {
      return this.getChildVal('subject');
    };

    clone(): JSJaCPacket {
      let oPacket:JSJaCMessage= new JSJaCMessage();
      oPacket.setDoc(this.getDoc().clone())
      return oPacket;
    }


}